def rjust(v, size):
    l = len(v)
    if l<size:
        return ' '*(size-l) + v
    else:
        return v


def trunc(value, size):
    if value:
        if len(value) > size:
            return value[:(size-3)] + '...'
        else:
            return value[:size]
    return value

def date(value, fmt):
    return value.strftime(fmt)
    
def method(obj, mtd, *args):
    return getattr(obj, mtd)(*args[2:])

tags = [trunc, rjust, date, method]